#include <stdio.h>

int countDigits(int n)
{
    int count  = 0;

    if(n == 0)
    {
        return 1;
    }
    else
    {
        while(n > 0)
        {
            count++;
            n /= 10;
        }

        return count;
    }
}

int main()
{
    int num;

    printf("请输入一个整数：");
    scanf("%d", &num);

    printf("该整数有%d位数字", countDigits(num));

    return 0;
}